Managing Python Packages in a Project

Description

Install required Python packages for your application from within the Alpha Anywhere IDE.

Discussion

You can use PIP to install Python modules into your Web Project. To open the PIP installer, click More... on the Web Projects Control Panel toolbar. Then, select Python > Install a Python Package (using PIP) command.

Click Add Package... install a package.

Manage Python Package dialog
Manage Python Package dialog

You can browse available Python packages using the Browse... button in the Install Python Package dialog.

Install Python Package dialog
Install Python Package dialog

Clicking Browse... opens a dialog where you can search for a Python package. Use the search box to search for a package. Verify the package is compatible with the version of Python used by Alpha Anywhere. You can determine what version is being used by running the following script in the Xbasic Interactive Window:

dim pythonCode as c

pythonCode = <<%str%
import sys
print(sys.version)
%str%

dim result as p

result = xbasic_execute_python(pythonCode)

? result.result
= 3.9.2 (tags/v3.9.2:1a79785, Feb 19 2021, 13:30:23) [MSC v.1928 32 bit (Intel)]

Select the desired package from the list. Then, click the Copy to clipboard icon next to the pip install command listed below the package name to select the package.

Copy the pip install command from the package page
Copy the pip install command from the package page

Next, click Close. The selected package will appear in the Package text box. Click Install... to install the package.

Install the Python package
Install the Python package

Python packages are installed to a folder called python in the web root of the Web Project.

Deleting Python Packages

To remove a Python package from your project, delete the package folder from the python directory in the Web Project.

Deleting a Python package
Deleting a Python package